import axios from 'axios'
import { Dispatch } from 'redux'

export let login=(values:any)=>{
    return async(dispatch:Dispatch)=>{
    let {data}=await axios.get("/api/login",{params:values})
    dispatch({
        type:"LOGIN",
        payload:Object.assign({},values,{...data})
    })
    }
}

export let reg=(values:any)=>{
    return async(dispatch:Dispatch)=>{
    let {data}=await axios.get("/api/reg",{params:values})
    console.log(data);
    dispatch({
        type:"REG",
        payload:Object.assign({},values,{...data})
    })
    }
}